<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<%@ page import="com.scalar.chiptrack.commons.Constants" %>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>

<chiptrack:checkLogon sourcePage="/rmaDisposition.do"/>
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();
    String userTypeChiptrac = Constants.USER_TYPE_CHIPTRAC + "";
%>

<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/quickSearch.js"></script>
<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">

<script language="javascript">
var listSize = 0;

window.onload = init;
function init()
{
    if ( document.rmaDispositionform.processStepId  != null)
    {
        qs_1 = new QuickSearch(document.rmaDispositionform.processStepId, document.rmaDispositionform.qs1, false);
    }
    if ( document.rmaDispositionform.rmaReceiveLotId  != null)
    {
        qs_2 = new QuickSearch(document.rmaDispositionform.rmaReceiveLotId, document.rmaDispositionform.qs2, false);
    }
}

function reset()
{
    document.rmaDispositionform.reset();
    qs_1.resetQuickSearchCntrl();
    qs_2.resetQuickSearchCntrl();

}

function searchLots()
{
    var form = document.rmaDispositionform;

    form.action.value="rmaLots";
    form.submit();
}

function searchLotsOnSubmit()
{
     var form = document.rmaDispositionform;

    form.action.value="rmaLots";
    form.submit();
}

function save()
{
    var pa=document.getElementById("message");

    pa.innerHTML                = '';
    var form                    = document.rmaDispositionform;
    var count1                  = 0;


    for( var i=0; i < listSize; i++ )
    {
        if( form['rmaLotsList['+i+'].checked'].checked == true  )
        {
            var shipQty;


           if ( form['rmaLotsList['+i+'].nextLocation'].value == '-1')
           {
                pa.innerHTML = "<li> Please select WIP Vendor";
                form['rmaLotsList['+i+'].nextLocation'].focus();
                return;
           }
           else if ( form['rmaLotsList['+i+'].nextProcessType'].value =='-1')
           {
               pa.innerHTML = "<li> Please select WIP Receive Process";
               form['rmaLotsList['+i+'].nextProcessType'].focus();
               return;

           }

            if ( form['rmaLotsList['+i+'].shipDieQty'] != null )
            {
                if ( isNaN( parseInt( form['rmaLotsList['+i+'].shipDieQty'].value ) ) )
                {
                      shipQty = 0;
                }
                else
                {
                      shipQty =  parseInt( form['rmaLotsList['+i+'].shipDieQty'].value );
                }
            }
            else
            {
                 shipQty = 0;
            }
            
            if( ( (+shipQty) ) == 0 )
            {
                pa.innerHTML = "<li> Zero Qty was not allowed:";
                form['rmaLotsList['+i+'].shipDieQty'].focus();
                return;
            }
            else if ( ( (+shipQty) ) > parseInt(form['rmaLotsList['+i+'].dieQtyIn'].value)  )
            {
                pa.innerHTML = "<li> WIP Qty should not be greater than RMA Qty In";
                form['rmaLotsList['+i+'].shipDieQty'].focus();
                return;
            }
            count1++;
        }
    }

    if( count1==0 )
	{
		pa.innerHTML = "<li> Please select atleast one lot";
		return;
	}

    form.action.value = "save";
    form.submit();
}

function checkLength(element, size)
{
    if(	element.value.length >= size )
	{
		event.returnValue = false;
	}
}

function enableDieQtyOutField( index )
{
    var pa=document.getElementById("message");

    pa.innerHTML                = '';
    var form                    = document.rmaDispositionform;

    if(form['rmaLotsList['+index+'].checked'].checked == true )
    {
        form['rmaLotsList['+index+'].shipDieQty'].disabled = false;
        form['rmaLotsList['+index+'].shipDieQty'].focus();
    }
    else
    {
        form['rmaLotsList['+index+'].shipDieQty'].value = "";
        form['rmaLotsList['+index+'].shipDieQty'].disabled = true;
    }
}

</script>
<!-- Top Header Start-->
<%--<%@ include file="/jsp/includes/header.jsp" %>--%>
<logic:equal value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
        <%@ include file="/jsp/includes/header.jsp" %>
    </logic:equal>
    <logic:notEqual value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
        <%@ include file="/jsp/includes/extHeader.jsp" %>
    </logic:notEqual>
<!-- Top Header End-->
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
	<td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
<!-- Side Navigation start -->
<%--<%@ include file="/jsp/operations/dataentryMenu.jsp" %>--%>
    <logic:equal value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
        <%@ include file="/jsp/operations/dataentryMenu.jsp" %>
    </logic:equal>
    <logic:notEqual value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
        <%@ include file="/jsp/operations/ext_user_dataentryMenu.jsp" %>
    </logic:notEqual>
<!-- end of the side navigations -->
<TD bgcolor="#ffffff">
<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
<TD valign="top" width="80%">
<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
<BR>
<html:form name="rmaDispositionform" method = "POST" onsubmit="javascript:searchLotsOnSubmit();" type="com.scalar.chiptrack.operations.dataentry.rmaDisposition.forms.RMADispositionForm" action="/rmaDisposition" >
<input type="hidden" name="action" value="<%= (String)request.getAttribute("action")%>">
<TABLE border="0" width="80%" align=center>
<TR><TD colspan=4 class="NArialW" align="center">RMA Dispose&nbsp;</TD><TD width="25%" class="NArialL">&nbsp;</TD></TR>

<TR><TD colspan=5>&nbsp;</TD></TR>
<TR><TD colspan=5 class='NArialL'><strong><FONT id="message" styleClass="NArialL" color='FF0000'></FONT></strong></TD></TR>
<TR>
   <TD colspan=4>
  <chiptrack:info  styleClass="NArialL" />
  <chiptrack:errors styleClass="NArialL" />
  <chiptrack:messages type="info" styleClass="NArialL" />
</TD><TD width="20%" class="NArialL">&nbsp;</TD></TR>
<logic:equal name="showMessage" value="TRUE">
    <tr><td colspan=5 align='left'><font class='NArialS'color='blue'><b><%=Constants.NO_MODIFY_RIGHTS %></b></font></TD></TR>
</logic:equal>
<TR><TD colspan=5>
<TABLE  border="0" width="80%" cellpadding="1" cellspacing="1">
    <TR>
        <TD class="NArialL" nowrap width='20%'>Quick Search: </TD>
        <TD class="NArialL" width='20%'>
            <input type="text" name="qs1" class="txfield" size='25' onkeyup='quickSearch(qs_1)'/>
        </TD>
        <TD COLSPAN=3>&nbsp;</TD>
    </TR>
    <TR>
        <logic:present name="partNumbersList" >
            <TD width="20%" nowrap class="NArialL">Product Name: </TD>
            <TD width="20%" class="NArialL">
                <html:select property="processStepId"  name="rmaDispositionform" styleClass="txfield">
                    <html:option value="0">Select Part Number</html:option>
                    <html:options collection="partNumbersList" property="value" labelProperty="label"/>
                </html:select>
            </TD>
         </logic:present>
         <logic:notPresent name="partNumbersList" scope="request">
            <TD width="20%" class="NArialL">&nbsp;</TD>
            <TD width="20%" class="NArialL">&nbsp;</TD>
        </logic:notPresent>
        <logic:present name="locationList" scope="request">
            <TD align="center" width="15%" class="NArialL">&nbsp;&nbsp;Location: </TD>
            <TD width="15%" class="NArialL">
                <html:select property="locationId" name="rmaDispositionform" styleClass="txfield">
                    <html:options collection="locationList" property="value" labelProperty="label"/>
                </html:select>
            </TD>
            <TD width="10%" class="NArialL">&nbsp;</TD>
        </logic:present>
        <logic:notPresent name="locationList" scope="request">
            <TD width="15%" class="NArialL">&nbsp;</TD>
            <TD width="15%" class="NArialL">&nbsp;</TD>
            <TD width="10%" class="NArialL">&nbsp;</TD>
       </logic:notPresent>
    </TR>
    <TR>
        <TD COLSPAN="5"><IMG SRC="<%=chipTracContext%>/jsp/includes/images/spacer.gif" HEIGHT=20></TD>
    </TR>
    <TR>
         <TD class="NArialL" nowrap width='20%'>Quick Search: </TD>
         <TD class="NArialL" width='20%'>
            <input type="text" name="qs2" class="txfield" size='25' onkeyup='quickSearch(qs_2)'/>
         </TD>
         <TD COLSPAN=3>&nbsp;</TD>
    </TR>
    <TR>
        <logic:present name="rmaLotsList" scope="request">
            <TD width="20%" class="NArialL">Lot Number: </TD>
            <TD width="20%" class="NArialL">
                <html:select property="rmaReceiveLotId" name="rmaDispositionform" styleClass="txfield">
                    <html:option value="0">Select Lot Number</html:option>
                    <html:options collection="rmaLotsList" property="rmaReceiveLotId" labelProperty="lotNumber"/>
                </html:select>
            </TD>
        </logic:present>
        <logic:notPresent name="rmaLotsList" scope="request">
            <TD width="20%" class="NArialL">&nbsp;</TD>
            <TD width="20%" class="NArialL">&nbsp;</TD>
       </logic:notPresent>
        <TD COLSPAN=3>&nbsp;</TD>
    </TR>

    <TR>
        <TD COLSPAN="5"><IMG SRC="<%=chipTracContext%>/jsp/includes/images/spacer.gif" HEIGHT=20></TD>
    </TR>

    <TR>
        <td colspan="5" align="center">
            <a href="javascript:searchLots()"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/search.gif" width="53" height="17" onmouseover="window.status='Click to Search for RMA Receive Lots';return true" onmouseout="window.status='';return true"title="Click to Search for RMA Receive Lots"/></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <a href="javascript:reset();"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" width="53" height="17" onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true" title="Click here to Reset"></a>
        </td>
    </TR>
    </TABLE></TD></TR>
 </TABLE>
    <nested:present property="rmaLotsList">
    <nested:size id="LotsSize" property="rmaLotsList"/>
    <logic:greaterThan name="LotsSize" value="0">
        <table border="0" width="100%" cellpadding="1" cellspacing="1">

            <TR>
                <TD colspan="5"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></TD>
            </TR>
            <TR>

            <td colspan="5">
                 <table align="left" border="0" id="binTable" width="100%">
                 <tr>
                    <td colspan="8"class='NArialL'><font class='NArialS'><font color='blue'>[Click on Select checkbox to Dispose RMA lot]</font></font></td>
                </tr>
                <tr bgcolor="#993333" align="center">
                    <td class='NArialL'><font color="#FFFFFF">Select </font></td>
                    <td nowrap class="NArialL"><font color="#FFFFFF">Part Number</font></td>
                    <td nowrap class="NArialL"><font color="#FFFFFF">Lot Number</font></td>
                    <td nowrap class="NArialL"><font color="#FFFFFF">RMA Number</font></td>
                    <td nowrap class="NArialL"><font color="#FFFFFF">Date Code</font></td>
                    <td class="NArialL"><font color="#FFFFFF">Vendor</font></td>
                    <td nowrap class="NArialL"><font color="#FFFFFF">Qty In</font></td>
                    <td class="NArialL"><font color="#FFFFFF">Date In</font></td>
                    <td class="NArialL"><font color="#FFFFFF">WIP Qty</font></td>
                    <td class="NArialL"><font color="#FFFFFF">WIP Vendor</font></td>
                    <td class="NArialL"><font color="#FFFFFF">WIP Process</font></td>
                    <td class="NArialL"><font color="#FFFFFF">Comments</font></td>

                </tr>

                <nested:iterate id="rmaLotInfo" property="rmaLotsList" indexId="iterateIdx" type="com.scalar.chiptrack.operations.dataentry.LotDetails">
                  <%
                 String click = "enableDieQtyOutField('" + iterateIdx.intValue() + "')";
                 %>
                <tr bgcolor='<%=iterateIdx.intValue() % 2 == 0 ? "#FFFFEE" : "#DEE1E2"%>'>
                <td width ="3%" align="center" ><font class='NArialL'><nested:checkbox  name="rmaLotInfo" property = "checked" onclick="<%= click %>"/> </td>
                <td nowrap><font class='NArialL'><nested:write name="rmaLotInfo" property ="partNumber"/> </font></td>
                <td nowrap><font class='NArialL'><nested:write name="rmaLotInfo" property ="lotNumber"/></font></td>
                <td nowrap><font class='NArialL'><nested:write name="rmaLotInfo" property ="rmaReceiveNo"/></font></td>
                <td nowrap><font class='NArialL'><nested:write name="rmaLotInfo" property ="dateCode"/></font></td>
                <td><font class='NArialL'><nested:write name="rmaLotInfo" property ="vendorName"/></font></td>
                <td><font class='NArialL'><nested:write name="rmaLotInfo" property ="dieQtyIn"/></font></td>
                <td><font class='NArialL'><nested:write name="rmaLotInfo" property ="dateIn"/></font></td>
                <nested:hidden name="rmaLotInfo" property="dieQtyIn"/>    
                <td class='NArialL' nowrap>
                    <input type="text" name="rmaLotsList[<%=iterateIdx.intValue()%>].shipDieQty" size ="8" value="" disabled="true" onkeypress="javascript:allowInteger()" class="valuetxfield"/>
                </td>
                 <td><font class='NArialL'>
                     <nested:select name="rmaLotInfo" property="nextLocation" styleClass="txfield">
                        <html:option value="-1" >-- Select -- </html:option>
                        <html:options collection="nextLocations" property="label" labelProperty="label"></html:options>
                     </nested:select>
                    </font>
                 </td>
                 <td><font class='NArialL'>
                    <nested:select name="rmaLotInfo" property="nextProcessType" styleClass="txfield">
                        <html:option value="-1" >-- Select -- </html:option>
                        <html:options collection="reciveProcessList" property="label" labelProperty="label"></html:options>
                    </nested:select>
                    </font>
                </td>
                 <td><font class='NArialL'>
                   <nested:textarea name="wipInfo" property="comments" onkeypress="javascript:checkLength(this, 1000)" styleClass="txfield" rows="2" cols="20"/>
                </font>
               </td>
                </tr>
                 </nested:iterate>
                  <nested:size id="binCount" property="rmaLotsList"/>
                    <script type="text/javascript">
                        listSize = <%= binCount.intValue()%>;
                    </script>

                 <TR>
                    <TD colspan="9"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></TD>
                 </TR>
                <TR>
                    <td colspan="6">&nbsp;</td>
                    <td colspan="2" align="center">
                        <a href="javascript:save()"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/save.gif" width="53" height="17" onmouseover="window.status='Click to Save RMA Receive Lots';return true" onmouseout="window.status='';return true"title="Click to Save RMA Receive Lots"/></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <a href="javascript:reset();"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" width="53" height="17" onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true" title="Click here to Reset"></a>
                    </td>
                </TR>
                </table>
            </td>
       </TR>
     </table>
     </logic:greaterThan>
    </nested:present>
</html:form>
<BR><BR><BR></TD>
<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>
<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</BODY>
</HTML>
<%--
<%

    }
    catch(Exception e)
    {
        e.printStackTrace();
    }
%>
--%>
